package org.openclinic.domain;

// Generated Nov 18, 2012 4:21:03 PM by Hibernate Tools 4.0.0

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.Size;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.hibernate.validator.constraints.NotEmpty;

/**
 * MedicalSpecialty generated by hbm2java
 */
@Entity
@Table(name = "medical_specialty", schema = "public", uniqueConstraints=@UniqueConstraint(columnNames = "name"))
public class MedicalSpecialty implements Serializable {

	private static final long serialVersionUID = 6428812893360207384L;
	
	private Long specialtyId;
	
	@Size(min = 2, max = 50)
	private String name;

	@NotEmpty
	private List<HealthProfessional> professionals;
	
	public MedicalSpecialty() {
		super();
	}

	public MedicalSpecialty(Long specialtyId, String name) {
		this.specialtyId = specialtyId;
		this.name = name;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "specialty_id", nullable = false)
	public Long getSpecialtyId() {
		return this.specialtyId;
	}

	public void setSpecialtyId(Long specialtyId) {
		this.specialtyId = specialtyId;
	}

	@Column(name = "name", unique = true, nullable = false, length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@JsonIgnore
	@ManyToMany(mappedBy="specialties")
	public List<HealthProfessional> getProfessionals() {
		return professionals;
	}

	public void setProfessionals(List<HealthProfessional> professionals) {
		this.professionals = professionals;
	}

}
